/* ************************************************************************

   Copyright: Prince Samuel

   License: MPL

   Authors: Prince Samuel

************************************************************************ */

/* Custom tree folder class
 */
qx.Class.define("ohmweb.TreeColumn", 
{
  extend : qx.ui.tree.VirtualTreeItem,

  construct : function() {
    this.base(arguments);

    this.addWidget(new qx.ui.core.Spacer(), {flex: 1});
    // Add a value label
    var value = new qx.ui.basic.Label();
    value.setWidth(150);
    this.addWidget(value);

    // Add a min label
    var min = new qx.ui.basic.Label();
    min.setWidth(150);
    this.addWidget(min);

    // Add a max label
    var max = new qx.ui.basic.Label();
    max.setWidth(150);
    this.addWidget(max);

    this.bind("value", value, "value");
    this.bind("min", min, "value");
    this.bind("max", max, "value");
  },


  properties : {
    value : {
      check : "String",
      event: "changeValue",
      //apply: "_applyValue",
      nullable: true
    },

    min : {
      check : "String",
      event: "changeMin",
      //apply: "_applyMin",
      nullable: true
    },

    max : {
      check : "String",
      event: "changeMax",
      //apply: "_applyMax",
      nullable: true
    }
  },

  members: {
               /*
     _createChildControlImpl : function(id)
     {
       var control;

       switch(id)
       {
         case "value":
           control = new qx.ui.basic.Label(this.getValue());
           control.setAnonymous(true);
           control.setWidth(150);
           this._add(control);
           break;

         case "min":
           control = new qx.ui.basic.Label(this.getMin());
           control.setAnonymous(true);
           control.setWidth(150);
           this._add(control);
           break;

         case "max":
           control = new qx.ui.basic.Label(this.getMax());
           control.setAnonymous(true);
           control.setWidth(150);
           this._add(control);
           break;
       }

       return control || this.base(arguments, id);
     },*/

    _applyValue : function(value, old) {
      var v = this.getChildControl("value");  
      v.setValue(value);
    },

    _applyMin : function(value, old) {
      var v = this.getChildControl("min");  
      v.setValue(value);
    },

    _applyMax : function(value, old) {
      var v = this.getChildControl("max");  
      v.setValue(value);
    }
  }
});
